{extend name="top/index" /}
{block name="main"}
	<!-- END SIDEBAR -->
	<!-- BEGIN CONTENT -->
	
	<div class="page-content-wrapper">
		<div class="page-content">
			<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
			<div class="modal fade" id="portlet-config" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
							<h4 class="modal-title">Modal title</h4>
						</div>
						<div class="modal-body">
							 Widget settings form goes here
						</div>
						<div class="modal-footer">
							<button type="button" class="btn blue">Save changes</button>
							<button type="button" class="btn default" data-dismiss="modal">Close</button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal-dialog -->
			</div>
			<!-- /.modal -->
			<!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
			<!-- BEGIN STYLE CUSTOMIZER -->
			<div class="theme-panel hidden-xs hidden-sm">
				<!-- <div class="toggler">
				</div> -->
				<div class="toggler-close">
				</div>
				<div class="theme-options">
					<div class="theme-option theme-colors clearfix">
						<span>
							 THEME COLOR
						</span>
						<ul>
							<li class="color-black current color-default" data-style="default">
							</li>
							<li class="color-blue" data-style="blue">
							</li>
							<li class="color-brown" data-style="brown">
							</li>
							<li class="color-purple" data-style="purple">
							</li>
							<li class="color-grey" data-style="grey">
							</li>
							<li class="color-white color-light" data-style="light">
							</li>
						</ul>
					</div>
					<div class="theme-option">
						<span>
							 Layout
						</span>
						<select class="layout-option form-control input-small">
							<option value="fluid" selected="selected">Fluid</option>
							<option value="boxed">Boxed</option>
						</select>
					</div>
					<div class="theme-option">
						<span>
							 Header
						</span>
						<select class="header-option form-control input-small">
							<option value="fixed" selected="selected">Fixed</option>
							<option value="default">Default</option>
						</select>
					</div>
					<div class="theme-option">
						<span>
							 Sidebar
						</span>
						<select class="sidebar-option form-control input-small">
							<option value="fixed">Fixed</option>
							<option value="default" selected="selected">Default</option>
						</select>
					</div>
					<div class="theme-option">
						<span>
							 Sidebar Position
						</span>
						<select class="sidebar-pos-option form-control input-small">
							<option value="left" selected="selected">Left</option>
							<option value="right">Right</option>
						</select>
					</div>
					<div class="theme-option">
						<span>
							 Footer
						</span>
						<select class="footer-option form-control input-small">
							<option value="fixed">Fixed</option>
							<option value="default" selected="selected">Default</option>
						</select>
					</div>
				</div>
			</div>
			<!-- END STYLE CUSTOMIZER -->
			<!-- BEGIN PAGE HEADER-->
			<div class="row">
				<div class="col-md-12">
					<!-- BEGIN PAGE TITLE & BREADCRUMB-->
					<h3 class="page-title">
					账户管理
					</h3>
					<ul class="page-breadcrumb breadcrumb">
						
						<li>
							<i class="fa fa-home"></i>
							<a href="{:url('index/index/index')}">
								Home
							</a>
							<i class="fa fa-angle-right"></i>
						</li>
						<li>
							<a href="{:url('index/Manage/index')}">
								账户管理
							</a>
							<i class="fa fa-angle-right"></i>
						</li>
					</ul>
					<!-- END PAGE TITLE & BREADCRUMB-->
				</div>
			</div>
			
			<!-- END PAGE HEADER-->
			<!-- BEGIN PAGE CONTENT-->
			<div class="row">
				<div class="col-md-12">
					<!-- Begin: life time stats -->
					<div class="portlet">
						<div class="portlet-title">
							<div class="caption">
								<i class="fa fa-gift"></i>添加部门
							</div>
							
						</div>
						<div>
					
							  <div class="form-group">
							    <label for="exampleInputEmail1">部门</label>
							    <input type="text" class="form-control" name="son" placeholder="部门" required="required" id="son">
							  </div>
							  <div class="form-group">
							    <label for="exampleInputPassword1">说明</label>
							    <input type="text" class="form-control" name="desc" placeholder="说明" required="required" id="desc">
							  </div>
							  <div class="form-group">
							    <label for="exampleInputFile">地址</label>
							    <input type="text" class="form-control" name="address" placeholder="地址" required="required" id="address">
							  </div>
							  <div class="form-group" style="width: 20%;">
							    <label for="exampleInputFile">类型:</label>
								   <select class="form-control" name="type" id="type">
								   	  <option value="-1">请选择部门类型</option>
									  <option value="0">中心机关</option>
									  <option value="1">基层单位</option>
									</select>
							  </div>
							  <div class="form-group" style="width: 20%;">
							    <label for="exampleInputFile">上级组织结构:</label>
								   <select class="form-control" name="org_name" id="zuzhi">
								   	<option value="-1">请选择上级组织结构</option>
								   	<option value="0">总分支</option>
								   	{volist name="oname" id="on"}
									<option value="{$on.org_id}">{$on.html}{$on.org_name}{$on.html}</option>
									{/volist}
									</select>
							  </div>
							  
							  <button type="submit" class="btn btn-success">添加</button>
							  <a href="javascript:history.back(-1)" class="btn btn-primary">取消</a>

						</div>
					</div>
					<!-- End: life time stats -->
				</div>
			</div>

			<!-- END PAGE CONTENT-->
		</div>
	</div>
	<!-- END CONTENT -->
</div>
<!-- END CONTAINER -->
<!-- BEGIN FOOTER -->
<div class="footer">
	<div class="footer-inner">
		 2018 &copy; 仁聚科技
	</div>
	<div class="footer-tools">
		<span class="go-top">
			<i class="fa fa-angle-up"></i>
		</span>
	</div>
</div>
<link href="/static/assets/css/toastr.min.css" rel="stylesheet"/>
<script src="/static/assets/js/toastr.min.js" rel="stylesheet"/></script>

<script>
	$('.btn-success').click(function(){
		if($('#son').val() == ''){
			toastr.error('请填写部门');
		}else if($('#type').val() == '-1'){
			toastr.error('请选择部门类型');
		}else if($('#zuzhi').val() == '-1'){
			toastr.error('请选择上级组织结构');
		}else{
			postdata();
		}
	});
	function postdata()
	{
		$.ajax({
                type:"POST",
                url:"{:url('index/Register/BmRegister')}",
                data:{
                	son : $('#son').val(),
                	desc : $('#desc').val(),
                	address : $('#address').val(),
                	type : $('#type').val(),
                	zuzhi : $('#zuzhi').val(),
                	zu : $('#zu').val()
                }, 
                dataType:'json',
                success:function(data){
                	if (data) {
			            toastr.success('创建成功');
			            setInterval(function(){
			              location.href = "{:url('index/Manage/index')}";
			            }, 2000);
			          }else{
			            toastr.error('创建失败，请重试');
			              location.reload(true);
			            
			          }
                },
                //Ajax请求超时，继续查询
                error:function(XMLHttpRequest,textStatus,errorThrown){
                   
                }
 
            });
	}
</script>
<script>
		$(function(){
			$('.manage').addClass("active");
		});
</script>
<!-- END FOOTER -->
<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
<!-- BEGIN CORE PLUGINS -->
<!--[if lt IE 9]>
    <script src="assets/plugins/respond.min.js"></script>
    <script src="assets/plugins/excanvas.min.js"></script> 
    <![endif]-->
<!-- <script src="assets/plugins/jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script> -->
<!-- IMPORTANT! Load jquery-ui-1.10.3.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
<!-- <script src="assets/plugins/jquery-ui/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="assets/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="assets/plugins/jquery.cokie.min.js" type="text/javascript"></script>
<script src="assets/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script> -->
<!-- END CORE PLUGINS -->
<!-- BEGIN PAGE LEVEL PLUGINS -->
<!-- <script type="text/javascript" src="assets/plugins/select2/select2.min.js"></script>
<script type="text/javascript" src="assets/plugins/data-tables/jquery.dataTables.js"></script>
<script type="text/javascript" src="assets/plugins/data-tables/DT_bootstrap.js"></script>
<script type="text/javascript" src="assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script> -->
<!-- END PAGE LEVEL PLUGINS -->
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<!-- <script src="assets/scripts/core/app.js"></script> -->
<!-- <script src="assets/scripts/core/datatable.js"></script>
<script src="assets/scripts/custom/ecommerce-products.js"></script> -->
<!-- END PAGE LEVEL SCRIPTS -->
<!-- <script>
        jQuery(document).ready(function() {    
           App.init();
           UITree.init();
        });
    </script> -->
<!-- END JAVASCRIPTS -->

</body>
<!-- END BODY -->
</html>
{/block}
